import os
from flask import Flask

from flask_cors import CORS
from applications.controllers import register_bps



def create_app():
    app = Flask(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
    app.json.ensure_ascii = False
    register_bps(app)
    CORS(app)

    pid = os.getpid()
    with open('python_proxy.pid', 'w') as f:
        f.write(str(pid))



    return app
